package mine.imgproc;

import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Toolkit;

/**
 * The Class ScreenUtils, screen set and cell parameters.
 */
public class ScreenUtils {
	
	private final static double START_X = 0.1078125;
	private final static double START_Y = 0.1222222;
	private final static double END_X = 0.8921848;
	private final static double END_Y = 0.8722222;
	private final static Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	private final static int DEFAULT_MINE_WIDTH = 30;
	private static final int DEFAULT_MINE_HEIGHT = 16;
	
	
	/**
	 * Gets the start point of the first cell left-top.
	 *
	 * @return the start point
	 */
	public final static Dimension getStartPoint() {
		int x = (int) (screenSize.width * START_X);
		int y = (int) (screenSize.height * START_Y);
		return new Dimension(x,y);
	}
	
	/**
	 * Gets the cell width.
	 *
	 * @return the cell width
	 */
	public final static int getCellWidth() {
		int size_width = (int) (screenSize.width * (END_X - START_X) / DEFAULT_MINE_WIDTH);
		int size_height = (int) (screenSize.height * (END_Y - START_Y)) / DEFAULT_MINE_HEIGHT ;
		return (size_height + size_width) / 2 ;
	}
	
	/**
	 * Gets the screen size.
	 *
	 * @return the screen size
	 */
	public final static Rectangle getScreenSize() {
		Rectangle screenRectangle = new Rectangle(screenSize.width,screenSize.height);
		return screenRectangle;
	}
	
//	public final static Dimension getCellClickPosition(int indexX, int indexY) {
//		int xPosition = 
//		
//	}
}
